from flask import request
from flask import Flask, render_template
import sql

app = Flask(__name__)


@app.route('/', methods=['GET', 'POST'])
def home():
    return render_template('login.html')


@app.route('/signin', methods=['POST'])
def signin():
    user = request.form['username']
    password = request.form['password']
    print(sql.DB(user, password))

    if sql.DB(user, password) == 1:
        return render_template('index.html')
    else:
        return '<h3>密码不正确</h3>'


if __name__ == '__main__':
    app.run()
